Skip to content

fix(extension): match redirect extra info to its response status - #3489

Open
arka6fx wants to merge 1 commit into
browserbase:mainfrom
arka6fx:fix/navigation-redirect-extra-info
Open

arka6fx wants to merge 1 commit into
browserbase:mainfrom
arka6fx:fix/navigation-redirect-extra-info

Conversation

@arka6fx

@arka6fx arka6fx commented Nov 18, 2026 •

Copy link
Copy Markdown

why

NavigationResponseTracker keeps the latest responseReceivedExtraInfo per request id. A redirect hop shares its request id with the final response, so when the final response has no extra info of its own (for example, it is served from the disk cache), the 3xx hop's headers, such as its set-cookie and location, are applied to the final 200 response returned by goto().

what changed

  • selectResponse applies stored extra info only when its statusCode matches the response status, and always clears the stored entry.
  • New tests/navigation-response-tracker.test.ts with a fake page and session.
  • Changeset: patch for the extension, the TS SDK and the Python SDK.

test plan

  • New test: 302 extra info, then a 200 document response from the disk cache with the same request id. On main, headerValue("set-cookie") returns the redirect's hop=1; with this change it is null. A second test checks that matching early extra info is still applied.
  • pnpm --filter @browserbasehq/stagehand-extension test:unit: 78 files, 1266 passed.
  • pnpm exec turbo run fmt:check lint typecheck --continue: 47/47 tasks passed.

Written with help from an AI coding agent; I've reproduced and tested it as described.

🤖 Generated with Claude Code


Summary by cubic

Fixes goto() sometimes returning a navigation response with headers from a redirect hop instead of the final response. Redirect hops share the request ID with the final response, so when the final response has no extra info of its own (for example, it comes from the disk cache), the 3xx hop's headers, such as its set-cookie and location, were applied to it.

  • Stored extra info is now applied only when its statusCode matches the response status, and the stored entry is always cleared afterward.
  • Adds unit tests covering both a matching early extra info and a redirect followed by a disk-cache response.

Written for commit b22e7ef. Summary will update on new commits.

View guided diff

NavigationResponseTracker keeps the latest responseReceivedExtraInfo per
request id. A redirect hop shares the request id with the final
response, so when the final response has no extra info of its own (for
example, it comes from the disk cache) the 3xx hop's headers were
applied to it. Only apply stored extra info whose statusCode matches the
response status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b22e7ef

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 19 packages
Name Type
@browserbasehq/stagehand-extension Patch
@browserbasehq/stagehand Patch
@browserbasehq/stagehand-python Patch
browse Patch
@browserbasehq/stagehand-examples Patch
@browserbasehq/stagehand-integrations-claude-cua-sdk Patch
@browserbasehq/stagehand-integrations Patch
@browserbasehq/eve Patch
@browserbasehq/stagehand-integrations-gemini-cua-sdk Patch
@browserbasehq/stagehand-integrations-example-pi-facade Patch
@browserbasehq/stagehand-integrations-claude-code Patch
@browserbasehq/stagehand-integrations-codex Patch
@browserbasehq/stagehand-integrations-cursor Patch
@browserbasehq/stagehand-integrations-deepagents-sdk Patch
@browserbasehq/stagehand-integrations-fx Patch
@browserbasehq/stagehand-integrations-mastra Patch
@browserbasehq/stagehand-integrations-pi-sdk Patch
@browserbasehq/stagehand-integrations-example-vercel-ai-facade Patch
@browserbasehq/stagehand-integrations-eve-harness Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

This PR is from an external contributor and must be approved by a stagehand team member with write access before CI can run.
Approving the latest commit mirrors it into an internal PR owned by the approver.
If new commits are pushed later, the internal PR stays open but is marked stale until someone approves the latest external commit and refreshes it.

@github-actions github-actions Bot added external-contributor Tracks PRs mirrored from external contributor forks. external-contributor:awaiting-approval Waiting for a stagehand team member to approve the latest external commit. labels Nov 18, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor:awaiting-approval Waiting for a stagehand team member to approve the latest external commit. external-contributor Tracks PRs mirrored from external contributor forks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant